package registnet.records.source;

import registnet.records.College;
import registnet.records.DegreeProgram;

public class DegreeProgramSource {

	private String degreeCode;
	private DegreeProgram degreeProgram;
	
	
	/**
	 * Default constructor
	 * 
	 * @param degreeCode - The code assigned to a degree program
	 */
	public DegreeProgramSource(String degreeCode){
		this.degreeCode = degreeCode;
		this.load();
	}
	
	
	/**
	 * Loads data from source
	 */
	public void load(){
		try{
			registnet.dao.DegreeCourse DAODegreeCourse = new registnet.dao.DegreeCoursePeer().getDegreeCourse(this.degreeCode);
			College college = new CollegeSource(DAODegreeCourse.getCollege().getCollegeCode()).getCollege();
			this.degreeProgram = new DegreeProgram(this.degreeCode);
			this.degreeProgram.setDegreeName(DAODegreeCourse.getDegreeName());
			this.degreeProgram.setCollege(college);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	
	/**
	 * Gets the degree program
	 * 
	 * @return	The degree program
	 */
	public DegreeProgram getDegreeProgram(){
		return this.degreeProgram;
	}
	
}
